<template>
  <el-container>
    <!--header-->
    <el-header class="my-header">
      <el-menu
        :default-active="activeIndex2"
        class="el-menu-demo"
        mode="horizontal"
        @select="handleSelect"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b">
        <el-menu-item index="1">首页</el-menu-item>
        <el-menu-item index="2">项目管理</el-menu-item>
        <el-menu-item index="3">运维管理</el-menu-item>
      </el-menu>
      <!--头像框-->
      <el-dropdown @command="handleCommand" class="my-dropdown">
         <span class="el-dropdown-link">
            下拉菜单
           <img data-v-51a2c380="" src="https://raw.githubusercontent.com/taylorchen709/markdown-images/master/vueadmin/user.png">
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="a">我的消息</el-dropdown-item>
          <el-dropdown-item command="b">设置</el-dropdown-item>
          <el-dropdown-item command="e" divided>退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </el-header>
    <!--main-->
    <el-main class="my-main">
      <router-view></router-view>
    </el-main>

  </el-container>
</template>

<script>
  //import $ from 'jquery'
  //修改了
//我想试试
  //我想试试冲突冲突冲突
  //直接编辑
  //我添加的自己的代码
  //branch修改
  import $ from 'jquery'
  export default {
    data() {
      return {
        activeIndex: '1',
        activeIndex2: '1'
      };
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key);
        switch (key) {
          case '1':
            this.$router.push('/home/home1');
            break;
          case '2':
            this.$router.push('/home/home2');
            break;
          case '3':
            this.$router.push('/home/home3');
            break;
          default:
            break;
        }
      },
      handleCommand(command) {
        this.$message('click on item ' + command);
 /*       $.ajax({
          type: "GET",
          url: "http://localhost:8080/zzq/handbook/retrieve",
          dataType:'json',
          data: {id:1001},//也可以是字符串链接"id=1001"，建议用对象
          success: function(data){
            console.log("返回的数据: " + data );
          },
          error:function(XMLHttpRequest, textStatus, errorThrown){
          // 通常 textStatus 和 errorThrown 之中
          // 只有一个会包含信息
          // this 调用本次AJAX请求时传递的options参数
           },
        //请求完成后回调函数 (请求成功或失败之后均调用)。参数： XMLHttpRequest 对象和一个描述成功请求类型的字符串
          complete:function(XMLHttpRequest, textStatus) {
          //this 调用本次AJAX请求时传递的options参数
          },
        });*/
        $.ajax({
          type: "GET",
          url: "../../static/a.json",
          dataType:'json',
        }).then(function (data) {
          console.log("返回的数据: " + data );
          return $.ajax({type: "GET", url: "../../static/a.json", dataType:'json',})
        },function (err) {
          console.log("返回的数据: " + err );
        }).then(function (data) {
          console.log("返回的数据: " + data );
        },function (err) {
          console.log("返回的数据: " + data );
        });

      }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE6;
  }

  .el-main {
    background-color: #E9EEF3;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
  .my-header{
    background-color: #545c64 ;
  }
  .my-main{
    width: 100%;
    position: absolute;
    top: 60px;
    bottom: 0;
    overflow: hidden;
    padding: 0;
    background-color: #ffffff;
  }

  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
  .my-dropdown{
    position: absolute;
    top: 0;
    right: 40px;
  }
  .my-dropdown span{
    color:#ffffff
  }
  .my-dropdown span img{
    width: 40px;
    height: 40px;
    border-radius: 20px;
    margin: 10px 0 10px 10px;
    float: right;
  }
</style>
